package prv.pursuivant.render;

import java.io.IOException;
import java.io.Writer;
import java.net.URI;

/**
 * Interface for objects storing generated text data. Objects with this
 * interface may be statefull. Methods should be called in following way:
 * <ul>
 * <li>startModel
 * <li>startMeta
 * <li>stopMeta
 * <li>startMeta
 * <li>stopMeta
 * <li>...
 * <li>...
 * <li>stopModel
 * </ul>
 * 
 * @author Kwinto
 * 
 */

public interface Destination {

	/**
	 * Starts new page (eg. new file)
	 * 
	 * @param id
	 * @return writer to write data to.
	 * @throws IOException
	 */
	Writer startPage(String id) throws IOException;

	/**
	 * Finishes with single page (eg. closing stream)
	 * 
	 * @throws IOException
	 */
	void stopPage() throws IOException;

	/**
	 * Starts processing model
	 * 
	 * @throws IOException
	 */
	void startModel(String modelDescription) throws IOException;

	/**
	 * Finishes processing model
	 * 
	 * @throws IOException
	 */
	void stopModel() throws IOException;

	/**
	 * Returns escaped URI for selected page, relative to other pages
	 * 
	 * @param id
	 * @return
	 */
	String getUriForPage(String id);

}
